package com.tian.scroll.view_move.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.TranslateAnimation;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;

import com.tian.scroll.R;
import com.tian.scroll.databinding.FragmentMoveViewTranslationBinding;

/**
 * @author tiansongtao, Email:769001510@qq.com, created on 2021/1/19 13:48
 *
 * view 动画移动
 */
public class TranslationViewFragment extends Fragment {

    private FragmentMoveViewTranslationBinding b;

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        b = DataBindingUtil.inflate(inflater, R.layout.fragment_move_view_translation, container, false);
        b.mbtTranslationView.setOnClickListener(v -> {
            TranslateAnimation animation = new TranslateAnimation(0f, 0f, 0f, 150f);
            animation.setDuration(1500);
            b.mbtTranslationView.startAnimation(animation);
        });
        return b.getRoot();
    }
}